unit uRelatorio_de_recebimentos;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, XPMenu, dxCore, dxButton, ExtCtrls, rpcompobase, rpvclreport,
  Buttons, StdCtrls, Mask, ToolEdit;

type
  TfRelatorio_de_recebimentos = class(TForm)
    Data1: TDateEdit;
    Label7: TLabel;
    Data2: TDateEdit;
    Label8: TLabel;
    BitBtn9: TBitBtn;
    Label3: TLabel;
    edCodCliente: TEdit;
    SpeedButton1: TSpeedButton;
    VCLReport1: TVCLReport;
    Panel2: TPanel;
    dxButton1: TdxButton;
    dxButton2: TdxButton;
    Panel1: TPanel;
    Label2: TLabel;
    Label1: TLabel;
    BitBtn1: TBitBtn;
    Edit1: TEdit;
    XPMenu1: TXPMenu;
    procedure SpeedButton1Click(Sender: TObject);
    procedure BitBtn9Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure dxButton1Click(Sender: TObject);
    procedure dxButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fRelatorio_de_recebimentos: TfRelatorio_de_recebimentos;

implementation

uses uProcurar, UDM;

{$R *.dfm}

procedure TfRelatorio_de_recebimentos.SpeedButton1Click(Sender: TObject);
begin
  FProcurar:=TFProcurar.Create(Self,dm.proc_proprietario);
  try
   FProcurar.BtnProcurar.Click;
   fProcurar.EvDBFind1.DataField := 'NOME_PROPRIETARIO';
   if FProcurar.ShowModal=mrOK then
  begin
   edCodCliente.Text := dm.proc_proprietarioNOME_PROPRIETARIO.AsString;
   Edit1.Text := IntToStr(dm.proc_proprietarioCOD_PROPRIETARIO.AsInteger);
  end;
  finally
   DM.proc_proprietario.Close;
   FProcurar.Free;
  end;
end;

procedure TfRelatorio_de_recebimentos.BitBtn9Click(Sender: TObject);
begin
  data1.Text:='  /  /    ';
  data2.Text:='  /  /    ';
end;

procedure TfRelatorio_de_recebimentos.BitBtn1Click(Sender: TObject);
begin
  Edit1.Text := '';
  edCodCliente.Text := '';
end;

procedure TfRelatorio_de_recebimentos.dxButton1Click(Sender: TObject);
begin
  VCLReport1.Filename := str_relatorio + 'Relatorio_de_recebimentos.rep';

  if Edit1.Text <> '' then
    VCLReport1.Report.Params.ParamByName('PCOD').Value := StrToInt(Edit1.Text)
  else
    VCLReport1.Report.Params.ParamByName('PCOD').Value := 9999999;
  if data1.Text = '  /  /    ' then
  begin
    MessageDlg('Preencha o campo Vencimento', mtWarning, [mbOK], 0);
    exit;
  end
  else
  begin
    VCLReport1.Report.Params.ParamByName('DATA1').Value := StrToDate(Data1.Text);
  end;

  if data2.Text = '  /  /    ' then
  begin
    MessageDlg('Preencha o campo Vencimento', mtWarning, [mbOK], 0);
    exit;
  end
  else
  begin
    VCLReport1.Report.Params.ParamByName('DATA2').Value := StrToDate(Data2.Text);
  end;
    VCLReport1.Execute;
end;

procedure TfRelatorio_de_recebimentos.dxButton2Click(Sender: TObject);
begin
 close;
end;

end.
